import { Component, OnInit } from '@angular/core';

@Component({
    selector: 'guide-birthday2',
    template: `
    <p>他的生日是{{ birthday | date:format }}</p>
    <button (click)="toggleFormat()">Toggle Format</button>
    `
})
export class Birthday2Component implements OnInit {
    birthday = new Date(1988, 3, 15); // April 15, 1988
    toggle = true;
    get format()   { return this.toggle ? 'yyyy-MM-dd' : 'yyyy/MM/dd'; }
    constructor() { }
    toggleFormat() { this.toggle = !this.toggle; }

    ngOnInit() { }
}